/**
 * A very simple company editor
 */
'use strict';
var Company = require('../../models/companyModel');

module.exports = function (router) {

        /**
         * Retrieve a list of all companies for editing.
         */
        router.get('/', function (req, res) {

                Company.find(function (err, comps) {
                        if (err) {
                                console.log(err);
                        }
                        // comps.forEach(function(prod) {
                        //         prod.prettyPrice = prod.prettyPrice();
                        // });
                        var model =
                        {
                                companies: comps
                        };
                        res.render('companies', model);                  // 'companies' 是dust的模块文件
                });
        });
};
